package com.getee.tianchaohongyu.kopier.parser

import com.getee.tianchaohongyu.kopier.NodeData


/**
 * 格式解析器
 * created zpf on 2019/2/18 0018
 */
object PatternParser : AbstractParser() {

    override fun parse(nodeData: NodeData, iterator: Iterator<Int>): NodeData {
        val result = find(iterator, ')')
        if (!result.have) throw RuntimeException("提前结束:${nodeData.fullName}(${nodeData.properties.joinToString { it.toString() }} ${result.contents}${result.char}")

        nodeData.pattern = result.contents
        return nodeData
    }
}